(function(a) {
    a("nav#dropdown").meanmenu({
        meanScreenWidth: "767",
        meanMenuContainer: ".mobile-menu"
    });
    a(".grid").imagesLoaded(function() {
        a(".shop-menu").on("click", "button", function() {
            var i = a(this).attr("data-filter");
            h.isotope({
                filter: i
            })
        });
        var h = a(".grid").isotope({
            itemSelector: ".grid-item",
            percentPosition: true,
            masonry: {
                columnWidth: ".grid-item",
            }
        })
    });
    a(".shop-menu button").on("click", function(h) {
        a(this).siblings(".active").removeClass("active");
        a(this).addClass("active");
        h.preventDefault()
    });
    var f = a("#slider-range");
    var b = a("#amount");
    f.slider({
        range: true,
        min: 40,
        max: 600,
        values: [20, 570],
        slide: function(h, i) {
            b.val("$" + i.values[0] + " - $" + i.values[1])
        }
    });
    b.val("$" + f.slider("values", 0) + " - $" + f.slider("values", 1));
    a(".testimonial-active").owlCarousel({
        loop: true,
        nav: false,
        navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
        responsive: {
            0: {
                items: 1
            },
            768: {
                items: 1
            },
            1000: {
                items: 1
            }
        }
    });
    a(".video-popup").magnificPopup({
        type: "iframe"
    });
    a(".details-tab").owlCarousel({
        loop: true,
        nav: true,
        items: 4,
        margin: 10,
        navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
        responsive: {
            0: {
                items: 3
            },
            768: {
                items: 4
            },
            1000: {
                items: 4
            }
        }
    });
    a(".product-curosel").owlCarousel({
        loop: true,
        nav: true,
        items: 4,
        navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
        responsive: {
            0: {
                items: 1
            },
            768: {
                items: 2
            },
            1000: {
                items: 4
            }
        }
    });
    a(".special-slider-active").owlCarousel({
        loop: true,
        nav: false,
        autoplay: true,
        items: 4,
        responsive: {
            0: {
                items: 1
            },
            768: {
                items: 2
            },
            1000: {
                items: 4
            }
        }
    });
    a("[data-countdown]").each(function() {
        var h = a(this),
            i = a(this).data("countdown");
        h.countdown(i, function(j) {
            h.html(j.strftime('<span class="cdown day">%-D <p>Days</p></span> <span class="cdown hour">%-H <p>Hour</p></span> <span class="cdown minutes">%M <p>Min</p></span class="cdown second"> <span>%S <p>Sec</p></span>'))
        })
    });
    var e = a(".stickey");
    var g = a(window);
    g.on("scroll", function() {
        var h = g.scrollTop();
        if (h < 1) {
            e.removeClass("stick")
        } else {
            e.addClass("stick")
        }
    });
    a("#customer").on("click", function() {
        a("#customer-login").slideToggle(900)
    });
    a("#coupon").on("click", function() {
        a("#have-coupon").slideToggle(900)
    });
    a.scrollUp({
        scrollText: '<i class="fa fa-angle-up"></i>',
        easingType: "linear",
        scrollSpeed: 900,
        animation: "fade"
    });
    a(".parallax-window").parallax();
    var c = a("#contact_form");
    c.validate({
        onfocusout: false,
        onkeyup: false,
        rules: {
            name: "required",
            email: {
                required: true,
                email: true
            }
        },
        errorPlacement: function(i, h) {
            i.insertBefore(h)
        },
        messages: {
            name: "What's your name?",
            email: {
                required: "What's your email?",
                email: "Please, enter a valid email"
            }
        },
        highlight: function(h) {
            a(h).text("").addClass("error")
        },
        success: function(h) {
            h.text("").addClass("valid")
        }
    });
    var d = a("#contact_submit");
    c.submit(function() {
        if (a(this).valid()) {
            d.button("loading");
            var h = a(this).attr("action");
            a.ajax({
                url: h,
                type: "POST",
                data: {
                    contactname: a("#contact_name").val(),
                    contactemail: a("#contact_email").val(),
                    contactmessage: a("#contact_message").val()
                },
                success: function() {
                    d.button("reset");
                    d.button("complete")
                },
                error: function() {
                    d.button("reset");
                    d.button("error")
                }
            })
        } else {
            d.button("reset")
        }
        return false
    })
})(jQuery);